Skip to content

Fix appearance model: late-seed dark companion after Realize#26

Merged
willwade merged 1 commit into
mainfrom
fix/appearance-late-seed
Jun 20, 2026
Merged

Fix appearance model: late-seed dark companion after Realize#26
willwade merged 1 commit into
mainfrom
fix/appearance-late-seed

Conversation

@willwade

Copy link
Copy Markdown

Problem

System appearance changes don't flip the palette — the canvas stays on the same colour scheme regardless of iOS light/dark setting.

Root cause

ensureAppearanceInitialised seeds darkPalette by looking up the current palette's companion. But frontends call dasher_set_system_appearance from their .onAppear handler, which fires before Realize() — before ColorIO is populated. At that point the companion lookup fails, darkPalette stays empty, and once appearanceLoaded = true the seed is never retried.

resolveAppearance then picks an empty darkPalette, falls back to lightPalette (or also empty), and returns without doing anything.

Timeline:

Fix

Add a late-seed check in resolveAppearance: if darkPalette is empty but lightPalette is set and ColorIO is now available, retry the companion lookup. Runs on every call, so once Realize completes and the next system/mode change arrives, the companion is found.

11 insertions, no deletions. No API change.

ensureAppearanceInitialised seeds the dark preference by looking up
the current palette's companion. But frontends typically call
dasher_set_system_appearance from their .onAppear handler, which
fires BEFORE Realize() (and before ColorIO is populated). At that
point the companion lookup fails, darkPalette stays empty, and once
appearanceLoaded is set to true the seed is never retried.

Result: system appearance changes never flip the palette —
resolveAppearance picks an empty darkPalette, falls back to an empty
lightPalette, and returns without doing anything.

Fix: add a late-seed check in resolveAppearance. If darkPalette is
empty but lightPalette is set and ColorIO is now available, retry
the companion lookup. This runs on every resolveAppearance call, so
once Realize completes and the next system-appearance change (or
mode change) arrives, the companion is found and dark mode works.

Signed-off-by: will wade <willwade@gmail.com>
@willwade willwade merged commit 5d6cfa0 into main Jun 20, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant